package com.xingyun.kingdee.erp.service.common.exceptions;

import com.xingyun.kingdee.erp.common.model.response.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author lingo
 * @version v1.0
 * @date 2020/8/12 9:30
 * @Company www.xyb2b.com
 */
@ControllerAdvice
@Slf4j
public class ErpExceptionHandler {

    @ExceptionHandler(ErpException.class)
    public Result<?> handleErpException(ErpException exception) {
        log.error("erp exception:{}",exception.getMessage(),exception);
        return Result.failure("601",exception.getMessage());
    }
}
